<template>
    <view>
        <view class="container">
            <view class="head bg-white">
                <text class="tit">请选择你的身份？</text>
                <text>>请选择你的身份，享受专属功能</text>
            </view>
            <view class="user_list">
                <view @tap="toTaskjob">
                    <image src="/static/imgs/icon/user1.png" class="wh100"></image>
                    <view class="poRel" style="z-index: 2;">
                        <text class="use_tit">我是求职者</text>
                        <text>免费发布、海量职位等您匹配</text>
                    </view>
                </view>
                <!-- <view @tap="toLogin">
                    <image src="/static/imgs/icon/user3.png"></image>
                    <view>
                        <text class="use_tit">我是企业</text>
                        <text>省时省力、找到对口人才</text>
                    </view>
                </view> -->
            </view>
        </view>

        <view class="cu-bar tabbar foot bg-white">
			<view class="action text-gray" @tap="toIndex">
				<view class="cuIcon-homefill"></view>
				首页
			</view>
			<view class="action text-gray" @tap="toFindjob">
				<view class="cuIcon-similar"></view>
				职位
			</view>
			<view class="action text-blue add-action" @tap="toMyinvate">
				<button class="cu-btn cuIcon-add bg-blue"></button>
				发布
			</view>
			<view class="action text-gray" @tap="toSysmsg">
			    <view class="cuIcon-notice"></view>
			    消息
			</view>
			<view class="action text-gray" @tap="toMyuser">
			    <view class="cuIcon-my"></view>
			    我的
			</view>
        </view>
    </view>
</template>

<script>
import { User } from '../../model/user-model.js';
var user = new User();
import { Token } from '../../utils/token.js';
var token = new Token();
import { Company } from '../../model/company-model.js';
var company = new Company();
export default {
    data() {
        return {};
    }
    /**
     * 生命周期函数--监听页面加载
     */,
    onLoad: function (options) {
        uni.setNavigationBarTitle({
            title: '发布'
        });
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {},
    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {},
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {},
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {},
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {},
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {},
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {},
    methods: {
        toIndex: function () {
            uni.redirectTo({
                url: '/pages/index/index'
            });
        },

        toFindjob: function (e) {
            var that = this;
            uni.redirectTo({
                url: '/pages/findjob/index'
            });
        },

        toSysmsg: function () {
            var that = this;
            uni.navigateTo({
                url: '/pages/sysmsg/index'
            });
        },

        toMyuser: function () {
            uni.redirectTo({
                url: '/pages/user/index'
            });
        },

        toPubOld: function () {
            uni.navigateTo({
                url: '/pages/pubold/index'
            });
        },

        toPubLet: function () {
            uni.navigateTo({
                url: '/pages/publet/index'
            });
        },

        toTaskjob: function () {
            var that = this;
            var params = {};
            token.verify(
                user.checkBind((data) => {
                    if (data.isbind) {
                        uni.navigateTo({
                            url: '/pages/mynote/index'
                        });
                    } else {
                        uni.navigateTo({
                            url: '/pages/register/index'
                        });
                    }
                }, params)
            );

            /*
         wx.navigateTo({
          url: "/pages/taskjob/index"
        })
          */
        },

        toLogin: function (e) {
            var that = this;
            var params = {};
            token.verify(
                user.checkBind((data) => {
                    if (data.isbind) {
                        var ctoken = uni.getStorageSync('ctoken');
                        if (ctoken) {
                            var params = {
                                ctoken: ctoken
                            };
                            company.checkLogin((data) => {
                                if (data.error == 0) {
                                    uni.navigateTo({
                                        url: '/pages/companycenter/index'
                                    });
                                } else {
                                    uni.navigateTo({
                                        url: '/pages/companylogin/index'
                                    });
                                }
                            }, params);
                        } else {
                            uni.navigateTo({
                                url: '/pages/companylogin/index'
                            });
                        }
                    } else {
                        uni.navigateTo({
                            url: '/pages/register/index'
                        });
                    }
                }, params)
            );
        }
    }
};
</script>
<style>
/* pages/login/index.wxss */
page {
    background-color: #fff;
}
.head {
    display: flex;
    flex-direction: column;
    padding: 47rpx 50rpx 50rpx;
}
.head > text {
    font-size: 26rpx;
    color: #999999;
}
.head > .tit {
    font-size: 50rpx;
    font-weight: bold;
    color: #333333;
    margin-bottom: 6rpx;
}
.user_list {
    display: flex;
    flex-direction: column;
    padding-left: 50rpx;
    padding-right: 50rpx;
}
.user_list > view {
    display: flex;
    margin-bottom: 32rpx;
}
.user_list > view > image {
    width: 650rpx;
    height: 200rpx;
    position: absolute;
    z-index: 1;
}
.user_list > view > view {
    display: flex;
    flex-direction: column;
    height: 200rpx;
    justify-content: center;
    margin-left: 310rpx;
	width: 320rpx;
}
.user_list > view > view text {
    font-size: 28rpx;
    color: #aeaeb9;
}
.user_list > view > view .use_tit {
    font-size: 36rpx;
    font-weight: bold;
    color: #333333;
    margin-bottom: 12rpx;
}

.choice {
    display: flex;
    align-content: center;
    justify-content: center;
}
.choice text {
    font-size: 28rpx;
    color: #999999;
    padding-top: 28rpx;
    padding-bottom: 28rpx;
}
</style>
